Skip to content

Feature/adding matching lights path tracer and rasterizer#87

Open
juanchuletas wants to merge 4 commits intomainfrom
feature/adding-matching-lights-path-tracer-and-rasterizer
Open

Feature/adding matching lights path tracer and rasterizer#87
juanchuletas wants to merge 4 commits intomainfrom
feature/adding-matching-lights-path-tracer-and-rasterizer

Conversation

@juanchuletas
Copy link
Copy Markdown
Member

@juanchuletas juanchuletas commented Apr 3, 2026

Description

Introduces a first-class light data model, viewport light gizmos, and a physically based multi-light rasterizer pipeline. Replaces the hardcoded single Phong light in SceneManager with a proper light list shared across the editor, gizmo renderer, and rasterizer.

Type of Change

  • New feature
  • Refactor

Changes Made

  • Added SceneLight struct and SceneLightType enum in Lights/light.hpp with Point, Sun, Spot, and Area types carrying position, color, power, and type-specific fields
  • Added std::vector m_lights to SceneManager with addLight, getLights, and getLightCount
  • Implemented LightGizmoRenderer with per-type geometry: wireframe sphere for Point, billboard quad for Sun/Spot/Area
  • Introduced GizmoMesh struct for clean per-type VAO/VBO ownership
  • Added gizmo_vs.glsl and gizmo_fs.glsl with billboard and world-space modes via isBillboard uniform
  • Rewrote LightEditorWindow to manage the light list with add, remove, select, and edit per-light properties
  • Updated fungt_default.fs and primitive_fs.glsl to support up to 8 lights via uniform array with physically based inverse square attenuation
  • Updated SceneManager::renderScene() to upload the full light array and viewPos
  • Fixed viewPos previously hardcoded to vec3(0, 2, 5) in the old fragment shader
  • Updated FunGT::update() to call m_sceneManager->updateViewPos(m_camera.getPosition())

Technical Details

Billboard gizmo extracts camera right and up vectors directly from view matrix columns. Gizmo sphere is three great circles generated procedurally at init, uploaded as a static VAO, positioned via lightWorldPos uniform at render time. Rasterizer attenuation changed from the Ogre3D polynomial approximation to true inverse square 1/(d^2 + 1e-6) matching the path tracer scale so both renderers respond consistently to the same power value.

Testing

  • Tested locally
  • Visual comparison before/after

Performance Impact

No measurable impact on rasterizer path. Gizmo render adds one draw call per light.

Notes for Reviewers

Path tracer light wiring via Space::loadLightsFromScene and Area light geometry generation are intentionally out of scope and tracked separately. The core_renderer.hpp directional light branch is included as a kernel-side prerequisite for the next PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant